<!--
 * @Author: cgl
 * @Date: 2023-04-18 15:12:26
 * @LastEditors: cgl
 * @LastEditTime: 2023-09-05 14:16:12
 * @FilePath: \public-health-emergencies-fed:\新放射\新radiation-hygiene-fe\src\views\slide\task.vue
 * @Description:
 *
 * Copyright (c) 2023 by cgl/微盛信息产业有限公司, All Rights Reserved.
-->
<template>
  <div class="app-container">
    <el-form
      class="searchform"
      :model="queryParams"
      ref="queryParams"
      size="small"
      label-width="80px"
    >
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="单位名称" label-width="80px">
            <m-select
              v-model="queryParams.entrustOrganizationId"
              placeholder="输入文字检索查询"
              style="width: 100%"
              filterable
              clearable
              :lists="entrustOrganizationSelect"
              lists_label="organizationName"
              lists_value="entrustOrganizationId"
              lists_key="entrustOrganizationId"
              :total="orgTotal"
              :pageSize="10"
              @handleChange="listeningEvent"
            >
            </m-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="合同编号">
            <el-input
              v-model="queryParams.agreementNumber"
              placeholder="请输入"
              clearable
              @keyup.enter.native="getList()"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="联系人">
            <el-input
              v-model="queryParams.contactsName"
              placeholder="请输入"
              clearable
              @keyup.enter.native="getList()"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="是否收费">
            <el-select
              v-model="queryParams.charge"
              placeholder="请选择"
              style="width: 100%"
            >
              <el-option
                :label="item.label"
                :value="item.value"
                v-for="(item, index) in dict.type.is_or_no"
                :key="index"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="是否打印">
            <el-select
              v-model="queryParams.isPrint"
              placeholder="请选择"
              style="width: 100%"
            >
              <el-option
                :label="item.label"
                :value="item.value"
                v-for="(item, index) in dict.type.is_or_no"
                :key="index"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="4">
          <el-form-item label-width="20px">
            <el-button
              type="primary"
              icon="el-icon-search"
              size="mini"
              @click="getList()"
              >搜索</el-button
            >
            <el-button icon="el-icon-refresh" size="mini" @click="reset()"
              >重置</el-button
            >
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <div class="table-wrapper">
      <div class="tableoperation">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          v-hasPermi="['task:personalDosimeter:add']"
          @click.native.prevent="openDialog()"
          >添加</el-button
        >
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click.native.prevent="openPrintDialog()"
          >批量打印</el-button
        >
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click.native.prevent="openParticipant"
          >参与人员</el-button
        >
        <el-button
          type="primary"
          size="mini"
          @click.native.prevent="handleGenerateTask"
          >生成任务</el-button
        >
      </div>

      <el-tabs v-model="activeName" @tab-click="changeTab" class="tab">
        <el-tab-pane label="待办理" name="-4" v-if="isPer"></el-tab-pane>
        <el-tab-pane label="待发放" name="-5"></el-tab-pane>
        <el-tab-pane label="待收样" name="-2"></el-tab-pane>
        <el-tab-pane label="收样中" name="-1"></el-tab-pane>
        <el-tab-pane label="待审批" name="1"></el-tab-pane>
        <el-tab-pane label="已签发" name="2"></el-tab-pane>
      </el-tabs>

      <el-table
        :row-class-name="taskRowClassName"
        :height="height - 443 + 'px'"
        v-loading="loading"
        :data="personalDosimeterList"
        @row-dblclick="(row) => openhandleDialog(row, '3')"
      >
        <el-table-column label="序号" type="index" align="center" class="number">
          <template slot-scope="scope">
            <div style="text-align: center;">{{ scope.$index+1 }}</div>
          </template>
        </el-table-column>
        <el-table-column
          label="合同编号"
          align="center"
          prop="agreementNumber"
        />
        <el-table-column label="是否收费" align="center" width="100">
          <template slot-scope="{ row }">
            <!-- <dict-tag
            :options="dict.type.is_or_no"
            :value="row.charge || 0"
          ></dict-tag> -->
            <span :style="{ color: row.charge == 1 ? '#67c23a' : 'red' }">{{
              row.charge == 1 ? "是" : "否"
            }}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="委托单位"
          align="center"
          prop="organizationName"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="联系人"
          align="center"
          prop="contactsName"
          width="100"
        />
        <el-table-column
          label="联系电话"
          align="center"
          prop="contactsMobile"
          width="150"
        />
        <el-table-column
          label="单位地址"
          align="center"
          prop="organizationAddress"
          width="150"
          :show-overflow-tooltip="true"
        />
        <el-table-column
          label="检测人员"
          align="center"
          prop="personNum"
          width="80"
        />
        <el-table-column label="是否打印" align="center" prop="isPrint">
          <template slot-scope="{ row }">
            <dict-tag
              :options="dict.type.is_or_no"
              :value="row.isPrint || 0"
            ></dict-tag>
          </template>
        </el-table-column>
        <el-table-column label="录入时间" align="center" prop="createTime" />
        <el-table-column label="年份" align="center" prop="year" width="100" />
        <el-table-column
          label="批次"
          align="center"
          prop="batchNum"
          width="60"
        />
        <el-table-column width="220" align="center" label="操作">
          <template slot-scope="{ row }">
            <el-button
              v-if="
                activeName == '-4' ||
                activeName == '-2' ||
                activeName == '-1' ||
                activeName == '-5' ||
                (activeName == '1' && row.canAudit == '1') ||
                (activeName == '1' && isLaboratory)
              "
              v-hasPermi="['task:personalDosimeter:handle']"
              @click.native.prevent="openhandleDialog(row, '1')"
              type="text"
            >
              办理
            </el-button>
            <el-button
              v-if="activeName == '1' || activeName == '2'"
              @click.native.prevent="handleFlowRecord(row)"
              type="text"
            >
              流程
            </el-button>
            <el-button
              v-if="activeName == '2'"
              @click.native.prevent="viewFile(row, true)"
              type="text"
            >
              报告
            </el-button>
            <el-button
              v-if="activeName == '2'"
              @click.native.prevent="viewAllFile(row)"
              type="text"
            >
              查看
            </el-button>
            <el-button
              v-if="activeName == '-5' && row.tasksState == '0'"
              @click.native.prevent="handleDelPersonal(row)"
              type="text"
            >
              删除
            </el-button>
            <el-button
              v-if="activeName == '2'"
              v-hasPermi="['task:personalDosimeter:withdraw']"
              @click.native.prevent="repeal(row, true)"
              type="text"
            >
              撤销
            </el-button>
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="total > 0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </div>

    <!-- 添加弹框 -->
    <el-dialog
      :title="title"
      :visible.sync="dialogVisible"
      :close-on-click-modal="false"
      width="1200px"
      class="addtask"
      v-dialogDrag="true"
    >
      <el-form
        :model="form"
        :disabled="status == '3'"
        :rules="rules"
        ref="form"
        size="small"
        label-width="100px"
        class="addform"
      >
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="单位名称" prop="entrustOrganizationId">
              <m-select
                v-model="form.entrustOrganizationId"
                :placeholder="status != '3' ? '输入文字检索查询' : ''"
                style="width: 100%"
                @change="changeEntrustOrganizationId"
                filterable
                clearable
                :lists="entrustOrganizationSelect"
                lists_label="organizationName"
                lists_value="entrustOrganizationId"
                lists_key="entrustOrganizationId"
                :total="orgTotal"
                :pageSize="10"
                @handleChange="listeningEvent"
              >
              </m-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="合同编号" prop="agreementId">
              <el-select
                v-model="form.agreementId"
                :placeholder="status != '3' ? '请选择' : ''"
                style="width: 100%"
                clearable
                @change="handleChangeAgreeMent"
              >
                <el-option
                  :label="item.agreementNumber"
                  :value="item.agreementId"
                  v-for="(item, index) in agreementList"
                  :key="index"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="联系人">
              <el-input v-model="form.contactsName" disabled />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="联系电话">
              <el-input v-model="form.contactsMobile" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="监测周期(天)">
              <el-input-number
                v-model="form.monitoringCycle"
                disabled
                :min="0"
                style="width: 100%"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="监测启用状态">
              <el-select
                v-model="form.monitoringState"
                placeholder=""
                disabled
                style="width: 100%"
              >
                <el-option
                  v-for="item in dict.type.status_disable"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="18">
            <el-form-item label="单位地址">
              <el-input v-model="form.organizationAddress" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="发放数量">
              <el-input v-model="form.sendNum" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="发样时间">
              <el-date-picker
                style="width: 100%"
                v-model="form.sendTime"
                value-format="yyyy-MM-dd"
                type="date"
                :picker-options="pickerOptionsF"
                placeholder="请选择"
                clearable
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="佩戴开始日期">
              <el-date-picker
                style="width: 100%"
                v-model="form.wearingBeginTime"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="date"
                :picker-options="pickerOptionsF"
                placeholder="请选择"
                clearable
                @change="(val) => handleChangeWearTime(val, 'wearingBeginTime')"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="佩戴结束日期">
              <el-date-picker
                style="width: 100%"
                v-model="form.wearingEndTime"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="date"
                :picker-options="pickerOptionsS"
                placeholder="请选择"
                clearable
                @change="(val) => handleChangeWearTime(val, 'wearingEndTime')"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="批次" prop="batchNum">
              <el-input v-model="form.batchNum" placeholder="请输入1 - 4批号" />
            </el-form-item>
          </el-col>
          <!-- <el-col :span="8">
            <el-button
							type="primary"
							size="small"
							@click.native.prevent="handleChangeWearingTime"
							v-if="status == '1'">
							保存
						</el-button>
					</el-col> -->
        </el-row>
      </el-form>

      <div ref="printcontainer">
        <div v-for="(item, index) in printList" :key="index" class="printmy">
          <div style="width: 16mm; line-height: 5.5mm">
            <div style="height: 5mm; font-size: 12px">
              {{ item.name }}
            </div>
            <div style="height: 5mm">
              {{ item.entrustDeptName ? item.entrustDeptName : " " }}
            </div>
            <div style="height: 5mm">
              {{ item.dosageType == "0" ? "正常" : "" }}
              {{ item.dosageType == "1" ? "铅衣内" : "" }}
              {{ item.dosageType == "2" ? "铅衣外" : "" }}
              {{ item.dosageType == "3" ? "本底" : "" }}
            </div>
          </div>
          <div style="height: 5mm; position: absolute; bottom: 3mm">
            佩戴时间：{{ item.wearingBeginTime.slice(0, 10) }} ~
            {{ item.wearingEndTime.slice(0, 10) }}
          </div>
          <svg class="barcode" :id="`barcode${index}`"></svg>
        </div>
      </div>

      <el-table
        class="handletabel"
        v-loading="loadingAdd"
        :data="form.taskPersonalDosimeterResultList"
        height="403"
      >
        <el-table-column
          label="人员编号"
          align="center"
          prop="personnelNumber"
          width="100"
        />
        <el-table-column
          label="剂量计编号"
          align="center"
          prop="dosageNumber"
          width="150"
        />
        <el-table-column
          label="姓名"
          align="center"
          prop="personnelName"
          width="130"
        >
          <template slot-scope="scope">
            <span>{{ scope.row.personnelName }}</span>
            <span v-if="scope.row.dosageType == 1">(内)</span>
            <span v-if="scope.row.dosageType == 2">(外)</span>
          </template>
        </el-table-column>
        <el-table-column label="性别" align="center" width="60">
          <template slot-scope="scope">
            <dict-tag
              :value="scope.row.personnelSex"
              :options="dict.type.sys_user_sex"
            ></dict-tag>
          </template>
        </el-table-column>
        <el-table-column label="职业分类" align="center">
          <template slot-scope="scope">
            <dict-tag
              :value="scope.row.occupationalClassification"
              :options="dict.type.occupational_classification"
            ></dict-tag>
          </template>
        </el-table-column>
        <el-table-column
          label="部门"
          align="center"
          prop="entrustDeptName"
          show-overflow-tooltip
        />
        <el-table-column
          label="身份证号"
          align="center"
          prop="idCard"
          width="160"
        />
        <el-table-column label="剂量计佩戴起止日期" align="center" width="180">
          <template slot-scope="{ row }">
            {{ parseTime(row.wearingBeginTime, "{y}/{m}/{d}") }} -
            {{ parseTime(row.wearingEndTime, "{y}/{m}/{d}") }}
          </template>
        </el-table-column>
        <el-table-column align="center" width="100" label="操作">
          <template slot-scope="scope">
            <el-button
              @click.native.prevent="deleteData(scope.row, scope.$index)"
              type="text"
              v-if="scope.row.taskPersonalResultId"
              style="color: #f32d2d"
            >
              删除
            </el-button>
            <el-button type="text" v-else style="opacity: 0">1</el-button>
          </template>
        </el-table-column>
      </el-table>

      <pagination
        style="margin-bottom: 5px"
        v-show="totalAdd > 0"
        :total="totalAdd"
        :page.sync="queryParamsAdd.pageNum"
        :limit.sync="queryParamsAdd.pageSize"
        @pagination="getListAdd"
      />

      <div slot="footer">
        <el-button type="primary" v-if="status != '3'" @click="submitForm"
          >确 定</el-button
        >
        <el-button @click="dialogVisible = false">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 办理弹框 -->
    <el-dialog
      :title="bltitle"
      :visible.sync="dialogVisiblehandle"
      :close-on-click-modal="false"
      width="1500px"
      class="bldialog"
      v-dialogDrag="true"
    >
      <el-form
        class="handleform"
        :disabled="blstatus != '1'"
        :rules="handlerRules"
        :model="handleform"
        size="small"
        label-width="100px"
      >
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="单位名称">
              <el-input v-model="handleform.organizationName" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="合同编号">
              <el-input
                v-if="handleform.agreementNumber"
                v-model="handleform.agreementNumber"
                disabled
              ></el-input>
              <el-select
                v-else
                v-model="handleform.agreementId"
                :placeholder="blstatus == '1' ? '请选择' : ''"
                style="width: 100%"
                clearable
              >
                <el-option
                  :label="item.agreementNumber"
                  :value="item.agreementId"
                  v-for="(item, index) in agreementList"
                  :key="index"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="联系人">
              <el-input v-model="filterContact" disabled />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="联系电话">
              <el-input v-model="filterMobile" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="监测周期(天)">
              <el-input-number
                v-model="handleform.monitoringCycle"
                disabled
                :min="0"
                style="width: 100%"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="监测启用状态">
              <el-select
                v-model="handleform.monitoringState"
                disabled
                style="width: 100%"
              >
                <el-option
                  v-for="item in dict.type.status_disable"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="18">
            <el-form-item label="单位地址">
              <el-input v-model="handleform.organizationAddress" disabled />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="发放数量">
              <el-input v-model="handleform.sendNum" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item label="发样时间">
              <el-date-picker
                style="width: 100%"
                v-model="handleform.sendTime"
                value-format="yyyy-MM-dd"
                type="date"
                :picker-options="pickerOptionsF"
                placeholder="请选择"
                clearable
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="佩戴开始日期">
              <el-date-picker
                style="width: 100%"
                v-model="handleform.wearingBeginTime"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="date"
                :picker-options="pickerOptionsHandleF"
                placeholder="请选择"
                clearable
                @change="
                  (val) => handleChangeHandleWearTime(val, 'wearingEndTime')
                "
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="佩戴结束日期">
              <el-date-picker
                style="width: 100%"
                v-model="handleform.wearingEndTime"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="date"
                :picker-options="pickerOptionsHandleS"
                placeholder="请选择"
                clearable
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="批次" prop="batchNum">
              <el-input
                v-model="handleform.batchNum"
                placeholder="请输入1 - 4批号"
                disabled
              />
            </el-form-item>
          </el-col>
          <!-- <el-col :span="6">
							<el-form-item label="送检时间" prop="expressageSigningTime">
								<el-date-picker
									style="width:100%;"
									v-model="handleform.expressageSigningTime"
									value-format="yyyy-MM-dd"
									type="date"
									placeholder="请选择"
									clearable>
								</el-date-picker>
							</el-form-item>
						</el-col> -->
        </el-row>
      </el-form>

      <div class="separate"></div>
      <el-form
        class="handleform"
        @submit.native.prevent
        :model="queryParamsHandle"
        size="small"
        label-width="100px"
      >
        <el-row :gutter="20">
          <el-col :span="8">
            <el-form-item label="关键词">
              <el-input
                v-model="queryParamsHandle.searchStr"
                placeholder="请输入人员编号、剂量计编号、人员姓名或部门"
                clearable
                @clear="getListHandle()"
                @keyup.enter.native="getListHandle()"
              />
            </el-form-item>
          </el-col>
          <el-col :span="1.5">
            <el-form-item label-width="20px">
              <el-button
                type="primary"
                icon="el-icon-search"
                size="mini"
                @click="getListHandle()"
                >查询</el-button
              >
            </el-form-item>
          </el-col>
          <!-- <template v-if="fileList128.length">
							<el-col :span="8"><div style="height: 20px"></div></el-col>
							<el-col :span="2">
								<el-form-item label-width="0" class="form-filelist">
									<span class="label">128</span>
									<div style="display: inline-block;border: 1px solid #969696;padding: 0 8px;">
										<span class="filelistitem" v-for="(item, index) in fileList128" :key="index" @click="viewFile(item)">{{ item.name }}</span>
									</div>
								</el-form-item>
							</el-col>
							<el-col :span="2">
								<el-form-item label-width="0" class="form-filelist">
									<el-button type="primary" size="mini" @click="viewFile(fileList.find(item => item.name == '报告-128'))">报告</el-button>
								</el-form-item>
							</el-col>
							<el-col :span="5">
								<el-form-item label-width="0" class="form-filelist">
									<span class="label">10264</span>
									<div style="display: inline-block;border: 1px solid #969696;padding: 0 8px;">
										<span class="filelistitem" v-for="(item, index) in fileList10264" :key="index" @click="viewFile(item)">{{ item.name }}</span>
									</div>
								</el-form-item>
							</el-col>
							<el-col :span="2">
								<el-form-item label-width="0" class="form-filelist">
									<el-button type="primary" size="mini" @click="handlePrintReports('128')">打印-128</el-button>
									<el-button type="primary" size="mini" @click="handlePrintReports('10264')">打印-10264</el-button>
								</el-form-item>
							</el-col>
						</template> -->
        </el-row>
      </el-form>

      <el-row type="flex" justify="space-between" class="contral-container">
        <el-col class="contral-col">
          <!-- <div class="filelist">
							查看文件：
							<span class="filelistitem" v-for="(item, index) in fileList" :key="index" @click="viewFile(item)">
								{{ item.name }}
							</span>
						</div> -->
          <el-upload
            ref="upload"
            :action="upload.url"
            :headers="upload.headers"
            :on-preview="handlePreview"
            :on-remove="handleRemoveRecord"
            :on-success="handleFileSuccessRecord"
            :before-upload="beforeAvatarUpload"
            :file-list="uploadRecordFileList"
            :limit="1"
            accept=".docx"
            :on-exceed="handleExceed"
          >
            <el-button
              v-if="blstatus == '1'"
              type="primary"
              :disabled="handleform.recordReportState != 2"
              size="mini"
              >上传记录</el-button
            >
          </el-upload>
          <el-upload
            class="docupload"
            ref="upload"
            :action="upload.url"
            :headers="upload.headers"
            :on-preview="handlePreview"
            :on-remove="handleRemove"
            :on-success="handleFileSuccess"
            :before-upload="beforeAvatarUpload"
            :file-list="uploadFileList"
            :limit="1"
            accept=".docx"
            :on-exceed="handleExceed"
          >
            <el-button
              v-if="blstatus == '1'"
              type="primary"
              :disabled="handleform.isReport != 2"
              size="mini"
              >上传报告</el-button
            >
          </el-upload>
          <el-button type="primary" @click="handleHistoryRecord" size="mini"
            >历史记录</el-button
          >
          <el-button
            type="primary"
            :disabled="selected.length == 0"
            size="mini"
            @click="handleDelItems"
            >批量删除</el-button
          >
          <div
            style="
              display: inline-block;
              border: 1px solid #969696;
              padding: 3px 8px;
              color: #1890ff;
              text-decoration: underline;
              cursor: pointer;
            "
            v-if="fileList128.find((item) => item.name == '原始记录')"
          >
            <span
              class="filelistitem"
              @click="
                viewFile(fileList128.find((item) => item.name == '原始记录'))
              "
              >原始记录</span
            >
          </div>
          <div
            style="
              display: inline-block;
              border: 1px solid #969696;
              padding: 3px 8px;
              color: #1890ff;
              text-decoration: underline;
              cursor: pointer;
            "
            v-if="fileList.find((item) => item.name == '报告-128')"
          >
            <span
              class="filelistitem"
              @click="
                viewFile(fileList.find((item) => item.name == '报告-128'))
              "
              >报告</span
            >
          </div>
          <div
            style="
              display: inline-block;
              border: 1px solid #969696;
              padding: 3px 8px;
              color: #1890ff;
              text-decoration: underline;
              cursor: pointer;
            "
            v-if="fileList.find((item) => item.name == '未签报告')"
          >
            <span
              class="filelistitem"
              @click="
                viewFile(fileList.find((item) => item.name == '未签报告'))
              "
              >未签报告</span
            >
          </div>
          <div style="margin-left: 10px" @click="handleRefreshReport">
            <i
              class="el-icon-refresh"
              style="font-size: 20px; cursor: pointer"
            ></i>
          </div>
          <!-- <el-button type="primary" size="mini" @click="viewFile(fileList128.find(item => item.name == '原始记录'))" v-if="fileList128.find(item => item.name == '原始记录')">原始记录</el-button> -->
          <!-- <el-button type="primary" size="mini" @click="viewFile(fileList.find(item => item.name == '报告-128'))" v-if="fileList.find(item => item.name == '报告-128')">报告</el-button> -->
        </el-col>

        <div v-if="blstatus == '1'" class="type">
          <span>生成类型：</span>
          <el-radio v-model="isPdf" label="1">pdf</el-radio>
          <el-radio v-model="isPdf" label="0">docx</el-radio>
        </div>
        <div style="display: flex; align-items: center">
          <el-button
            v-if="blstatus == '1' || blstatus == '2'"
            class="blbutton"
            type="primary"
            size="mini"
            @click="launch(0)"
            >保 存</el-button
          >
          <el-button
            v-if="blstatus == '1'"
            class="blbutton"
            type="primary"
            size="mini"
            @click.native.prevent="editTrackingNumber()"
            >发样</el-button
          >
          <el-button
            v-if="blstatus == '1'"
            class="blbutton"
            type="primary"
            size="mini"
            icon="el-icon-plus"
            @click.native.prevent="addLine()"
            >添加人员</el-button
          >
          <el-button
            v-if="blstatus == '1'"
            class="blbutton"
            type="primary"
            size="mini"
            @click.native.prevent="openAddDosimeter"
            >添加剂量计</el-button
          >
          <el-button
            v-if="blstatus == '1'"
            class="blbutton"
            type="primary"
            :disabled="!handleform.list || handleform.list.length == 0"
            size="mini"
            @click.native.prevent="handleGenerateReport"
            >生成</el-button
          >
          <!-- <el-button v-if="blstatus == '1'" class="blbutton" type="primary" :disabled="!handleform.list || handleform.list.length == 0" size="mini" @click.native.prevent="handleReport('record')">生成记录</el-button> -->
          <!-- <el-button v-if="blstatus == '1'" class="blbutton" type="primary" :disabled="!handleform.list || handleform.list.length == 0" size="mini" @click.native.prevent="handleReport()">生成报告</el-button> -->
          <el-popover
            placement="top"
            width="auto"
            trigger="hover"
            class="all-contral"
          >
            <!-- <el-button v-for="(item, index) in fileRecordList" :key="'record'+index" class="blbutton" type="primary" size="mini" @click.native.prevent="viewFile(item)">打印原始记录</el-button> -->
            <!-- <el-button v-for="(item, index) in fileList" :key="index" class="blbutton" type="primary" size="mini" @click.native.prevent="viewFile(item, null, true)">打印报告</el-button> -->
            <el-button
              v-if="blstatus == '1'"
              class="blbutton"
              type="primary"
              :disabled="!handleform.list || handleform.list.length == 0"
              size="mini"
              @click.native.prevent="handlePrint()"
              >打印编号</el-button
            >
            <el-button
              v-if="blstatus == '1'"
              type="primary"
              size="mini"
              @click.native.prevent="handlePrintnotice()"
              >打印告知书</el-button
            >
            <el-button
              v-if="blstatus == '1'"
              type="primary"
              size="mini"
              @click.native.prevent="handlePrintTurnoverRegister()"
              >打印流转登记表</el-button
            >
            <el-button
              slot="reference"
              class="blbutton"
              type="primary"
              size="mini"
              >打印</el-button
            >
          </el-popover>
        </div>
        <!-- <el-button v-if="blstatus == '1'" class="blbutton" type="primary" :disabled="!handleform.list || handleform.list.length == 0" size="mini" @click.native.prevent="handlePrint()">打印编号</el-button> -->
        <!-- <el-button v-if="blstatus == '1'" type="primary" size="mini" @click.native.prevent="handlePrintTurnoverRegister()">打印流转登记表</el-button> -->
      </el-row>
      <el-table
        class="handletabel"
        ref="tableData"
        :class="blstatus == '2' && 'handletabelaudit'"
        v-loading="loadingHandle"
        :data="handleform.list"
        :row-class-name="tableRowClassName"
        :cell-class-name="tableCellClassName"
        @selection-change="handleSelectionChange"
        height="356"
        border
        @row-dblclick="dbclick"
      >
        <el-table-column
          type="selection"
          align="center"
          width="50"
          :selectable="selectable"
        />
        <el-table-column
          label="人员编号"
          align="center"
          prop="personnelNumber"
          width="120"
        />
        <el-table-column
          label="剂量计编号"
          align="center"
          prop="dosageNumber"
          width="120"
        />
        <el-table-column label="姓名" align="center" width="auto">
          <template slot-scope="scope">
            <!--v-if去判断双击的是不是当前单元格-->
            <el-input
              @blur="hideInput(scope.row)"
              size="mini"
              :ref="scope.row.index + ',' + scope.column.index"
              v-model="scope.row.personnelName"
              v-if="
                scope.row.index + ',' + scope.column.index == currentCell &&
                !scope.row.isadd
              "
            >
            </el-input>

            <!--v-if去判断双击的是不是当前单元格-->
            <el-select
              @change="changeUnhandledPerson($event, scope.row)"
              size="mini"
              :ref="scope.row.index + ',' + scope.column.index"
              v-model="scope.row.showTypeName"
              v-if="
                scope.row.index + ',' + scope.column.index == currentCell &&
                scope.row.isadd
              "
              class="selectperson"
              style="width: 100%"
            >
              <el-option
                v-for="item in unHandleWorkPersonnelList"
                :key="item.dosageNumber"
                :label="
                  item.personnelName +
                  (item.dosageType == '1'
                    ? '(内)'
                    : item.dosageType == '2'
                    ? '(外)'
                    : '')
                "
                :value="
                  item.personnelName +
                  (item.dosageType == '1'
                    ? '(内)'
                    : item.dosageType == '2'
                    ? '(外)'
                    : '')
                "
              >
              </el-option>
            </el-select>

            <span
              v-if="scope.row.index + ',' + scope.column.index != currentCell"
            >
              <span>{{ scope.row.personnelName }}</span>
              <span v-if="scope.row.dosageType == 1">(内)</span>
              <span v-if="scope.row.dosageType == 2">(外)</span>
            </span>
          </template>
        </el-table-column>
        <el-table-column label="性别" align="center" width="auto">
          <template slot-scope="scope">
            <!--v-if去判断双击的是不是当前单元格-->
            <el-select
              @change="hideInput(scope.row)"
              size="mini"
              :ref="scope.row.index + ',' + scope.column.index"
              v-model="scope.row.personnelSex"
              v-if="
                scope.row.index + ',' + scope.column.index == currentCell &&
                !scope.row.isadd
              "
              style="width: 100%"
            >
              <el-option
                v-for="item in dict.type.sys_user_sex"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>

            <dict-tag
              v-else
              :value="scope.row.personnelSex"
              :options="dict.type.sys_user_sex"
            ></dict-tag>
          </template>
        </el-table-column>
        <el-table-column
          label="职业类别"
          align="center"
          width="150"
          :show-overflow-tooltip="true"
        >
          <template slot-scope="scope">
            <!--v-if去判断双击的是不是当前单元格-->
            <el-select
              @change="hideInput(scope.row)"
              size="mini"
              :ref="scope.row.index + ',' + scope.column.index"
              v-model="scope.row.occupationalClassification"
              v-if="
                scope.row.index + ',' + scope.column.index == currentCell &&
                !scope.row.isadd
              "
              style="width: 100%"
            >
              <el-option
                v-for="item in dict.type.occupational_classification"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>

            <dict-tag
              v-else
              :value="scope.row.occupationalClassification"
              :options="dict.type.occupational_classification"
            ></dict-tag>
          </template>
        </el-table-column>
        <!-- <el-table-column label="部门" align="center" prop="entrustDeptName"/> -->
        <el-table-column label="剂量计佩戴起止日期" align="center" width="210">
          <template slot-scope="scope">
            <span
              v-if="
                scope.row.index + ',' + scope.column.index == currentCell &&
                !scope.row.isadd
              "
            >
              <!-- v-model="[scope.row.wearingBeginTime, scope.row.wearingEndTime]" -->
              <el-date-picker
                @blur="hideInput(scope.row)"
                size="mini"
                :ref="scope.row.index + ',' + scope.column.index"
                v-model="scope.row.wearingTimes"
                class="wearingedit"
                style="width: 100%"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="daterange"
                :clearable="false"
              >
              </el-date-picker>
            </span>

            <span v-else>
              {{ parseTime(scope.row.wearingBeginTime, "{y}/{m}/{d}") }} -
              {{ parseTime(scope.row.wearingEndTime, "{y}/{m}/{d}") }}
            </span>
          </template>
        </el-table-column>
        <!-- <el-table-column label="寄出单号" align="center" prop="sendTrackingNumber" :width="blstatus != '3' && 130">
						<template slot-scope="scope">
							<el-input
								v-if="scope.row.index + ',' + scope.column.index == currentCell && !scope.row.isadd && scope.row.isEmptyTrackingNumber"
								@blur="hideInput(scope.row)"
								size="mini"
								:ref="scope.row.index + ',' + scope.column.index"
								v-model="scope.row.sendTrackingNumber">
							</el-input>

							<span v-else>
								<span>{{scope.row.sendTrackingNumber}}</span>
							</span>
						</template>
					</el-table-column> -->
        <el-table-column
          label="剂量当量1"
          align="center"
          prop="holeOneDosageValue"
          width="80"
        />
        <el-table-column
          label="剂量当量2"
          align="center"
          prop="holeTwoDosageValue"
          width="80"
        />
        <el-table-column
          label="剂量当量(mSv)"
          align="center"
          prop="dosageValue"
          width="80"
        />
        <el-table-column
          label="异常原因"
          align="center"
          prop="describe"
          show-overflow-tooltip
          width="120"
        />
        <el-table-column
          label="操作"
          align="center"
          width="150"
          v-if="blstatus != '3'"
        >
          <template slot-scope="scope">
            <el-button
              v-if="scope.row.dosageType != 3"
              size="mini"
              type="text"
              @click="handleChangeShowReport(scope.row)"
              >{{ scope.row.showReport == 1 ? "显示" : "隐藏" }}</el-button
            >
            <el-button
              size="mini"
              type="text"
              class="ovbutton"
              style="color: #f32d2d"
              @click="deleteItem(scope.$index)"
              v-if="
                !scope.row.sendTrackingNumber && scope.row.dosageType != '3'
              "
              >删除</el-button
            >
            <el-button
              size="mini"
              type="text"
              class="ovbutton"
              disabled
              v-if="scope.row.exceptional"
              >已报备</el-button
            >
            <el-button
              size="mini"
              type="text"
              class="ovbutton"
              @click="handleException(scope.row, '2')"
              v-else-if="largeDose && scope.row.dosageValue > largeDose"
              >异常报备</el-button
            >
            <el-button
              size="mini"
              type="text"
              class="ovbutton"
              @click="handleException(scope.row, '1')"
              v-else-if="
                !(scope.row.holeOneDosageValue && scope.row.holeTwoDosageValue)
              "
              >异常报备</el-button
            >
          </template>
        </el-table-column>
      </el-table>

      <pagination
        style="margin-bottom: 5px"
        v-show="totalHandle > 0"
        :total="totalHandle"
        :page.sync="queryParamsHandle.pageNum"
        :limit.sync="queryParamsHandle.pageSize"
        @pagination="getListHandle"
      />

      <div slot="footer">
        <el-button
          type="primary"
          v-if="blstatus == '1' || blstatus == '2'"
          class="blbtn"
          @click="launch(1)"
          >办 理</el-button
        >
        <el-button
          type="danger"
          v-if="blstatus == '2'"
          class="blbtn"
          @click="launch(2)"
          >驳 回</el-button
        >
        <el-button v-if="blstatus == '3'" @click="repeal(handleform)"
          >撤销</el-button
        >
        <el-button
          v-if="blstatus == '1' || blstatus == '3'"
          @click="dialogVisiblehandle = false"
          >关 闭</el-button
        >
      </div>
    </el-dialog>

    <!-- 异常报备 -->
    <el-dialog
      :visible.sync="abnormalVisible"
      :close-on-click-modal="false"
      :title="abnormalTitle"
      width="500px"
      v-dialogDrag="true"
      append-to-body
    >
      <el-form
        ref="abnormalRefs"
        class="abnormalVisible"
        :model="abnormalFrom"
        :rules="abnormalRules"
        size="small"
        label-width="120px"
      >
        <el-row :gutter="20">
          <el-col :span="24">
            <el-form-item label="异常类型" prop="exceptionType">
              <el-select
                v-model="abnormalFrom.exceptionType"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in dict.type.exception_state"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="异常原因" prop="describe">
              <el-autocomplete
                class="inline-input"
                style="width: 100%"
                v-model="abnormalFrom.describe"
                :fetch-suggestions="querySearch"
                placeholder="请输入内容"
                value-key="label"
              ></el-autocomplete>
            </el-form-item>
          </el-col>
          <el-col :span="24">
            <el-form-item label="名义剂量" prop="addNotionalDoseFlag">
              <el-radio-group v-model="abnormalFrom.addNotionalDoseFlag">
                <el-radio
                  v-for="(item, index) in dict.type.is_or_no"
                  :key="index"
                  :label="item.value"
                  >{{ item.label }}</el-radio
                >
              </el-radio-group>
            </el-form-item>
          </el-col>
          <el-col :span="24" v-if="abnormalFrom.addNotionalDoseFlag == 1">
            <el-form-item label="剂量值" prop="notionalDose">
              <el-input
                v-model="abnormalFrom.notionalDose"
                placeholder="请输入名义剂量"
                clearable
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer">
        <el-button type="primary" @click="handleAbnormalConfim"
          >确 认</el-button
        >
        <el-button @click="abnormalVisible = false">关 闭</el-button>
      </div>
    </el-dialog>

    <!-- 添加剂量计 -->
    <el-dialog
      title="添加剂量计"
      :visible.sync="dosimeterVisible"
      :close-on-click-modal="false"
      width="800px"
      class="dosimeterDialog"
      v-dialogDrag="true"
      :show-close="false"
    >
      <el-form
        :model="dosimeterForm"
        :rules="dosimeterRules"
        ref="dosimeterRefs"
        size="small"
        label-width="120px"
      >
        <el-row :gutter="20" style="display: flex; flex-wrap: wrap">
          <!-- <el-col :span="12">
						<el-form-item label="是否本底" prop="personnelNumber">
							<el-radio-group v-model="radio">
                <el-radio v-for="(item, index) in is_or_no" :key="index" :label="item.value">备选项</el-radio>
              </el-radio-group>
						</el-form-item>
					</el-col> -->
          <el-col :span="12">
            <el-form-item label="人员编号" prop="personnelNumber">
              <el-input
                v-model="dosimeterForm.personnelNumber"
                placeholder="请输入"
                clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="人员姓名" prop="personnelName">
              <el-input
                v-model="dosimeterForm.personnelName"
                placeholder="请输入"
                clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="人员性别" prop="personnelSex">
              <el-select
                v-model="dosimeterForm.personnelSex"
                placeholder="请选择"
                style="width: 100%"
              >
                <el-option
                  :label="item.label"
                  :value="item.value"
                  v-for="(item, index) in dict.type.sys_user_sex"
                  :key="index"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="职业类别" prop="occupationalClassification">
              <el-select
                v-model="dosimeterForm.occupationalClassification"
                placeholder="请选择"
                style="width: 100%"
              >
                <el-option
                  :label="item.label"
                  :value="item.value"
                  v-for="(item, index) in dict.type.occupational_classification"
                  :key="index"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否穿戴铅衣" prop="wearLeadCoat">
              <el-select
                v-model="dosimeterForm.wearLeadCoat"
                placeholder="请选择"
                style="width: 100%"
              >
                <el-option
                  :label="item.label"
                  :value="item.value"
                  v-for="(item, index) in dict.type.is_or_no"
                  :key="index"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="佩戴时间" prop="wearingTimes">
              <el-date-picker
                size="mini"
                v-model="dosimeterForm.wearingTimes"
                class="wearingedit"
                style="width: 100%"
                value-format="yyyy-MM-dd HH:mm:ss"
                type="daterange"
                :clearable="false"
              >
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="dosimeterForm.wearLeadCoat == '0'">
            <el-form-item label="剂量计编号" prop="dosageNumber">
              <el-input
                v-model="dosimeterForm.dosageNumber"
                placeholder="请输入"
                clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="dosimeterForm.wearLeadCoat == '1'">
            <el-form-item label="铅衣外编号" prop="dosageNumberOutside">
              <el-input
                v-model="dosimeterForm.dosageNumberOutside"
                placeholder="请输入"
                clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="dosimeterForm.wearLeadCoat == '1'">
            <el-form-item label="铅衣内编号" prop="dosageNumberWithin">
              <el-input
                v-model="dosimeterForm.dosageNumberWithin"
                placeholder="请输入"
                clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer">
        <el-button type="primary" @click="handleDosimeterConfim"
          >确 认</el-button
        >
        <el-button @click="dosimeterVisible = false">关 闭</el-button>
      </div>
    </el-dialog>

    <!-- 修改快递单号弹框 -->
    <!-- <el-dialog
			title="修改快递单号"
			:visible.sync="editTrackingNumberVisible"
			:close-on-click-modal="false"
			width="600px"
			v-dialogDrag="true"
		>
			<el-form class="seachform" @submit.native.prevent :model="editTrackingNumberForm" :rules="rulesTracking" ref="editTrackingNumberForm" size="small" label-width="120px">
				<el-row>
					<el-col :span="20">
						<el-form-item label="快递单号" prop="sendTrackingNumber">
							<el-input
								v-model="editTrackingNumberForm.sendTrackingNumber"
								placeholder="请输入"
								clearable
								@keyup.enter.native="submitTrackingNumber"
							/>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
			<div slot="footer">
				<el-button type="primary" @click="submitTrackingNumber">确 定</el-button>
			</div>
		</el-dialog> -->
    <!-- 意见弹框 -->
    <el-dialog
      title="审批意见"
      :visible.sync="manageVisible"
      :close-on-click-modal="false"
      width="600px"
      v-dialogDrag="true"
    >
      <el-input
        v-model="manageForm.comment"
        type="textarea"
        placeholder="请输入审批意见"
        clearable
      />
      <div slot="footer">
        <el-button type="primary" @click="submitManageData">确 定</el-button>
      </div>
    </el-dialog>

    <!-- 历史记录 -->
    <history-record ref="historyRecordRefs" />
    <WorkFlow ref="workFlow"></WorkFlow>
    <batch-print ref="batchPrintRefs"></batch-print>
    <!-- 添加参与人员 -->
    <participant ref="participantRefs" />

    <report-dialog ref="reportDialogRefs" />

    <OuterTaskGenerateDialog
      :show.sync="showOuterTaskGenerateDialog"
    ></OuterTaskGenerateDialog>
  </div>
</template>

<script>
import {
  personalDosimeterList,
  personalDosimeterDetail,
  personalDosimeterEdit,
  personalDosimeterAdd,
  getHandleData,
  personalDosimeterHandle,
  personalDosimeterProcess,
  generateReport,
  uploadReport,
  getWorkingPersonnelByOrganizationId,
  personalDosimeterRemove,
  getUnHandleWorkPersonnelList,
  addSendTrackingNumber,
  withdrawTask,
  genCirculationRegister,
  getTaskDosimeterNextInfo,
  getQueryCanGenAnnualDose,
  genDosageNotification,
  removePersonalDosimeter,
  personalPrintReport,
} from "@/api/slides/task";
import {
  addExceptionalRecord,
  getConfiglargeDose,
} from "@/api/slides/abnormal";
import { updateShowReport } from "@/api/slides/autoSampleRegister";
import { getWaitSendPersonnelListByIds } from "@/api/slides/waitSend";
import { getAgreementListWithTaskDosimeter } from "@/api/person/entrustAgreement";
import {
  entrustOrganizationListing,
  entrustOrganizationList,
} from "@/api/person/entrustOrganization";
import { listOss, listByIds, delOss } from "@/api/system/oss";
import WorkFlow from "@/components/WorkFlow";
import { getLodop, needCLodop } from "@/utils/LodopFuncs.js";
import { handlePrintReport } from "@/utils/lodop/printFun.js";
import MSelect from "@/components/mSelect";
import BatchPrint from "./waitSend.vue";
import { getToken } from "@/utils/auth";
import { blobToBase64 } from "@/utils/file";
import { parseTime } from "@/utils/ruoyi";
import HistoryRecord from "./components/task/historyRecord";
import {
  printCodeZY,
  handlePrintTurnoverRegister,
  handlePrintNotice,
} from "@/utils/lodop/printFun.js";
import Participant from "./components/task/participant";
import ReportDialog from "./components/task/reportDialog.vue";
import moment from "moment";
import { addDosageNumber } from "@/api/slides/slideSample";
import OuterTaskGenerateDialog from "./component/OuterTaskGenerateDialog.vue";

export default {
  name: "task",
  dicts: [
    "status_disable",
    "is_or_no",
    "sys_user_sex",
    "occupational_classification",
    "exception_state",
    "exception_type",
  ],
  components: {
    MSelect,
    WorkFlow,
    BatchPrint,
    HistoryRecord,
    Participant,
    ReportDialog,
    OuterTaskGenerateDialog,
  },
  data() {
    return {
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        tasksState: "-4",
      },
      total: 0,
      dialogVisible: false,
      // 表单参数
      form: {},
      loading: false,
      status: null,
      title: null,
      handlerRules: {
        batchNum: [
          { required: true, message: "批号不能为空", trigger: "blur" },
          {
            pattern: /^\d+$/,
            message: "批号只能1-4",
            trigger: "blur",
          },
        ],
      },
      rules: {
        entrustOrganizationId: [
          { required: true, message: "单位名称不能为空", trigger: "blur" },
        ],
        // agreementId: [
        //   { required: true, message: "合同不能为空", trigger: "blur" },
        // ],
        batchNum: [
          { required: true, message: "批号不能为空", trigger: "blur" },
          {
            pattern: /^\d+$/,
            message: "批号只能1-4",
            trigger: "blur",
          },
        ],
      },
      // 委托单位下拉框
      entrustOrganizationSelect: [],
      activeName: "-4",
      // 外照射任务列表
      personalDosimeterList: [],
      // 办理弹框
      dialogVisiblehandle: false,
      handleStatus: null,
      handleform: {},
      blstatus: null,
      bltitle: null,
      // 删除的人员
      deletePerson: [],
      // 合同下拉框
      agreementList: [],
      tableList: [], // 打印的标签集合
      nubId: [], // 标签顶部的条形码数据
      printOptions: [], // 打印机数据
      printType: "", // label1 -> 4*6; A4 -> A4
      LODOP: null,
      printList: [],
      // 办理的查询参数
      queryParamsHandle: {
        pageNum: 1,
        pageSize: 10,
        searchStr: "",
      },
      totalHandle: 0,
      // 打开的当行id
      handleId: null,
      loadingHandle: false,
      // 添加的查询参数
      queryParamsAdd: {
        pageNum: 1,
        pageSize: 10,
      },
      totalAdd: 0,
      // 打开的当行id
      addId: null,
      loadingAdd: false,
      height: document.documentElement.clientHeight - 205 + "px;",
      isPer: false,
      isHide: false,
      // 日期校验
      pickerOptionsF: {
        // disabledDate: (time) => {
        //   return time.getTime() > new Date(this.form.wearingEndTime).getTime();
        // },
      },
      pickerOptionsS: {
        // disabledDate: (time) => {
        //   return time.getTime() < new Date(this.form.wearingBeginTime).getTime();
        // },
      },
      pickerOptionsHandleF: {
        // disabledDate: (time) => {
        //   return time.getTime() > new Date(this.handleform.wearingEndTime).getTime();
        // },
      },
      pickerOptionsHandleS: {
        // disabledDate: (time) => {
        //   return time.getTime() < new Date(this.handleform.wearingBeginTime).getTime();
        // },
      },
      pickerOptionsHandleEdit: {
        disabledDate: (time) => {
          return (
            time.getTime() > new Date(this.handleform.wearingEndTime).getTime()
          );
        },
      },
      // 生成的报告列表
      fileList: [],
      fileList128: [],
      fileList10264: [],
      fileCmaList: [],
      // 勾选的打印列表
      selected: [],
      // 双击索引
      currentCell: null,
      // 未办理人员列表添行
      unHandleWorkPersonnelList: [],
      // 视图高度
      height: document.documentElement.clientHeight,
      // 修改快递单号
      editTrackingNumberVisible: false,
      editTrackingNumberForm: {},
      rulesTracking: {
        sendTrackingNumber: [
          { required: true, message: "快递单号不能为空", trigger: "blur" },
        ],
      },
      // 大剂量标准值
      largeDose: null,
      openRowHandle: {},
      isLaboratory: false,
      // 单位查询数据
      organizationQueryData: {
        organizationName: "", //单位名称模糊查询
        pageNum: 1, //页码
        pageSize: 10, //每页展示的条数
      },
      orgTotal: 0,
      fileRecordList: [],
      isPdf: "1",
      // 用户导入参数
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        headers: {
          Authorization: "Bearer " + getToken(),
          "Content-Disposition": "inline",
        },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/system/oss/upload",
      },
      uploadFileList: [],
      uploadRecordFileList: [],
      manageForm: {},
      manageVisible: false,
      historyRecodeList: [],
      // 异常
      abnormalTitle: "",
      abnormalVisible: false,
      abnormalFrom: {},
      abnormalRules: {
        exceptionType: [
          {
            required: true,
            message: "异常类型不能为空",
            trigger: ["blur", "change"],
          },
        ],
        describe: [
          {
            required: true,
            message: "异常原因不能为空",
            trigger: ["blur", "change"],
          },
        ],
        addNotionalDoseFlag: [
          {
            required: true,
            message: "名义剂量不能为空",
            trigger: ["blur", "change"],
          },
        ],
        notionalDose: [
          {
            required: true,
            message: "剂量值不能为空",
            trigger: ["blur", "change"],
          },
        ],
      },
      dosimeterVisible: false,
      currRow: {},
      dosimeterForm: {},
      dosimeterRules: {
        personnelNumber: [
          {
            required: true,
            message: "人员编号不能为空",
            trigger: ["blur", "change"],
          },
        ],
        personnelName: [
          {
            required: true,
            message: "人员姓名不能为空",
            trigger: ["blur", "change"],
          },
        ],
        personnelSex: [
          {
            required: true,
            message: "人员性别不能为空",
            trigger: ["blur", "change"],
          },
        ],
        wearLeadCoat: [
          {
            required: true,
            message: "是否穿戴铅衣",
            trigger: ["blur", "change"],
          },
        ],
        occupationalClassification: [
          {
            required: true,
            message: "职业类别不能为空",
            trigger: ["blur", "change"],
          },
        ],
        wearingTimes: [
          {
            required: true,
            message: "佩戴时间不能为空",
            trigger: ["blur", "change"],
          },
        ],
        dosageNumber: [
          {
            required: false,
            message: "剂量计编号不能为空",
            trigger: ["blur", "change"],
          },
        ],
        dosageNumberOutside: [
          {
            required: false,
            message: "铅衣外编号不能为空",
            trigger: ["blur", "change"],
          },
        ],
        dosageNumberWithin: [
          {
            required: false,
            message: "铅衣内编号不能为空",
            trigger: ["blur", "change"],
          },
        ],
      },

      showOuterTaskGenerateDialog: false,
    };
  },
  inject: ["getAppLoading"],
  computed: {
    app_loading() {
      return this.getAppLoading();
    },
    filterContact() {
      return this.handleform.dosageContactsName || this.handleform.contactsName;
    },
    filterMobile() {
      return (
        this.handleform.dosageContactsMobile || this.handleform.contactsMobile
      );
    },
  },
  watch: {
    "form.wearingBeginTime": {
      deep: true,
      handler(newv, oldv) {
        if (newv && !this.form.sendTime) {
          const date = new Date(newv);
          const mDate = new Date(date.setDate(date.getDate() - 7));
          this.form.sendTime = parseTime(mDate, "{y}-{m}-{d} {h}:{i}:{s}");
        }
      },
    },
    "handleform.wearingBeginTime": {
      deep: true,
      handler(newv, oldv) {
        if (newv && !this.handleform.sendTime) {
          const date = new Date(newv);
          const mDate = new Date(date.setDate(date.getDate() - 7));
          this.handleform.sendTime = parseTime(
            mDate,
            "{y}-{m}-{d} {h}:{i}:{s}"
          );
        }
      },
    },
  },
  created() {
    // 未发起栏的权限控制（领导层没有）
    let permissions = this.$store.getters.permissions;
    console.log("权限", permissions, this.$route);
    let found = permissions.find((item) => {
      return item == "task:personalDosimeter:handle";
    });
    this.isPer =
      found == "task:personalDosimeter:handle" || permissions == "*:*:*";
    if (!this.isPer) {
      /* 领导层 */
      this.activeName = "-3";
      this.queryParams.tasksState = "-3";
    }
    // 获取角色信息 (实验室人员也可以办理)
    let roles = this.$store.getters.roles;
    this.isLaboratory = roles.indexOf("laboratory") != -1;
    // 首页快捷入口跳转而来 切换到已签发
    if (this.$route.params.isEntry) {
      this.activeName = "2";
      this.queryParams.tasksState = "2";
    }
    // 首页待办跳转而来 打开办理弹窗
    if (this.$route.params.isTodo) {
      this.openhandleDialog(this.$route.params, "1");
    }
    // 获取列表
    this.getList();
    // 获取大剂量标准值
    this.configlargeDose();
  },
  methods: {
    // 切换tab栏
    changeTab(tab, event) {
      this.queryParams.tasksState = tab.name;
      this.personalDosimeterList = [];
      this.getList();
    },
    // 批量打印
    openPrintDialog() {
      // console.log(this.$refs.batchPrintRefs);
      this.$refs.batchPrintRefs.openDialog();
    },
    // 查看流程
    handleFlowRecord(row) {
      this.$refs.workFlow.openDialog(row);
    },
    // 参与人员
    openParticipant() {
      this.$refs.participantRefs.openDialog();
    },
    // 添加剂量计
    openAddDosimeter() {
      this.dosimeterForm = {
        wearLeadCoat: "0",
      };
      this.dosimeterVisible = true;
    },
    handleDosimeterConfim() {
      this.$refs["dosimeterRefs"].validate((valid) => {
        if (!valid) return;
        const data = { ...this.dosimeterForm };
        data.taskPersonalDosimeterId = this.currRow.taskPersonalDosimeterId;
        data.wearingBeginTime = data.wearingTimes[0] || null;
        data.wearingEndTime = data.wearingTimes[1] || null;
        delete data.wearingTimes;
        addDosageNumber(data).then((response) => {
          this.$modal.msgSuccess("添加成功");
          this.dosimeterVisible = false;
        });
      });
    },
    // 异常的不允许勾选
    selectable(row, rowIndex) {
      if (
        (this.largeDose && row.dosageValue > this.largeDose) ||
        row.exceptional
      ) {
        return false;
      } else {
        return true;
      }
    },
    // 获取外照射任务列表
    getList() {
      this.loading = true;
      personalDosimeterList(this.queryParams)
        .then((response) => {
          this.personalDosimeterList = response.rows || [];
          this.total = response.total;
          this.loading = false;
        })
        .catch((response) => {
          this.loading = false;
        });
    },
    // 历史记录
    handleHistoryRecord() {
      this.$refs.historyRecordRefs.openDialog(this.handleform);
    },
    // 获取单位下拉框
    listeningEvent(e) {
      let { queryName, pageNum, pageSize, type } = e;
      if (type == "scroll" && pageNum == this.organizationQueryData.pageNum)
        return;
      this.organizationQueryData.organizationName = queryName;
      this.organizationQueryData.pageNum = pageNum;
      this.organizationQueryData.pageSize = pageSize;
      entrustOrganizationList(this.organizationQueryData).then((response) => {
        if (type == "scroll") {
          this.entrustOrganizationSelect.push(...response.rows);
        } else {
          this.entrustOrganizationSelect = response.rows;
        }
        this.orgTotal = response.total;
      });
    },
    // 获取大剂量标准值
    configlargeDose() {
      getConfiglargeDose().then((response) => {
        this.largeDose = response.msg;
      });
    },
    taskRowClassName({ row, rowIndex }) {
      if (row?.warn == 1) {
        // return "warning-row";
        return "";
      }
      return "";
    },
    // 列表标红
    tableRowClassName({ row, rowIndex }) {
      if (
        (this.largeDose && row.dosageValue > this.largeDose) ||
        row.exceptional
      ) {
        return "warning-row";
      }
      return "";
    },
    handleDelPersonal(row) {
      this.$alert(
        `是否删除单位：${row.organizationName || ""} 外照射任务`,
        "提示",
        {
          confirmButtonText: "确定",
          callback: async (action) => {
            if (action == "confirm") {
              await removePersonalDosimeter(row.taskPersonalDosimeterId);
              this.$modal.msgSuccess("删除成功");
              this.getList();
            }
          },
        }
      );
    },
    // 撤销
    repeal(row) {
      this.$alert(
        `是否撤销年份${row.year} 、批次${row.batchNum}、合同编号：${
          row.agreementNumber || ""
        }的设备任务`,
        "提示",
        {
          confirmButtonText: "确定",
          callback: async (action) => {
            if (action == "confirm") {
              await withdrawTask(row.taskPersonalDosimeterId);
              this.$modal.msgSuccess("撤销成功");
              this.dialogVisiblehandle = false;
              this.getList();
            }
          },
        }
      );
    },
    // 打开任务对话框
    openDialog() {
      this.form = {
        taskPersonalDosimeterResultList: [],
      };
      this.agreementList = [];
      this.resetForm("form");
      this.deletePerson = [];
      this.status = "1";
      this.title = "添加外照射任务";
      this.dialogVisible = true;
    },
    handleChangeAgreeMent(val) {
      if (!val) {
        return;
      }
      const query = {
        agreementId: val,
      };
      getTaskDosimeterNextInfo(query).then((res) => {
        const data = res.data;
        this.form = {
          ...this.form,
          batchNum: data.batchNum,
          wearingBeginTime: data.wearingBeginTime,
          wearingEndTime: data.wearingEndTime,
        };
        this.handleChangeWearingTime();
      });
      // console.log('合同号' + query);
    },
    handleChangeWearTime(val, timeTips) {
      console.log(timeTips);
      if (timeTips == "wearingBeginTime") {
        const date = new Date(val);
        const mDate = new Date(moment(date).add(3, "M").subtract(1, "d"));
        // const mDate = new Date(date.setDate(date.getDate() + 90))
        let newDate = parseTime(mDate, "{y}-{m}-{d} {h}:{i}:{s}");
        this.$set(this.form, "wearingEndTime", newDate);
        this.handleChangeWearTime(newDate, "wearingEndTime");
      }
      this.form.taskPersonalDosimeterResultList.forEach((item) => {
        this.$set(item, timeTips, val);
      });
    },
    handleChangeHandleWearTime(val, timeTips) {
      const date = new Date(val);
      const mDate = new Date(moment(date).add(3, "M").subtract(1, "d"));
      // const mDate = new Date(date.setDate(date.getDate() + 90))
      let newDate = parseTime(mDate, "{y}-{m}-{d} {h}:{i}:{s}");
      this.$set(this.handleform, timeTips, newDate);
    },
    handleChangeWearingTime() {
      const startTime = this.form.wearingBeginTime;
      const endTime = this.form.wearingEndTime;
      this.form.taskPersonalDosimeterResultList.forEach((item) => {
        this.$set(item, "wearingBeginTime", startTime);
        this.$set(item, "wearingEndTime", endTime);
      });
    },
    // 批量删除
    handleDelItems() {
      this.selected.map((item) => {
        const subIndex = this.handleform.list.findIndex(
          (i) => i.taskPersonalResultId == item.taskPersonalResultId
        );
        this.deleteItem(subIndex, true);
      });
      this.$refs["tableData"].clearSelection();
    },
    // 提交任务
    submitForm() {
      console.log("this.form", this.form);
      this.$refs["form"].validate((valid) => {
        if (!valid) return;
        if (
          this.form.sendTime &&
          this.form.wearingBeginTime &&
          new Date(this.form.sendTime).getTime() >
            new Date(this.form.wearingBeginTime).getTime()
        ) {
          this.$modal.msgError("发样时间应在佩戴开始日期之前");
          return;
        }
        console.log("this.deletePerson", this.deletePerson);
        let deleteIds = this.deletePerson.map((item) => {
          return {
            taskPersonalResultId: item.taskPersonalResultId,
            dosageType: item.dosageType,
          };
        });
        if (this.status == "1") {
          let form = {
            entrustOrganizationId: this.form.entrustOrganizationId,
            agreementId: this.form.agreementId,
            sendTime: this.form.sendTime,
            wearingBeginTime: this.form.wearingBeginTime,
            wearingEndTime: this.form.wearingEndTime,
            deleteItems: deleteIds,
            batchNum: this.form.batchNum,
            addBatchNum: this.form.addBatchNum,
          };
          personalDosimeterAdd(form).then((response) => {
            this.$modal.msgSuccess("新增成功");
            this.dialogVisible = false;
            this.getList();
          });
        } else if (this.status == "2") {
        }
      });
    },
    // 打开办理对话框
    openhandleDialog(row, status) {
      this.currRow = row;
      this.handleform = {};
      this.fileList = [];
      this.fileRecordList = [];
      this.selected = [];
      this.currentCell = null;
      this.handleStatus = status;
      this.openRowHandle = row;
      this.handleform.taskPersonalDosimeterId = row.taskPersonalDosimeterId;
      this.uploadFileList = [];
      this.uploadRecordFileList = [];
      this.isPdf = "1";
      if (status == "1") {
        if (this.activeName == "1") {
          this.blstatus = "2";
        } else {
          this.blstatus = "1";
        }
        this.bltitle = "办理";
      }
      if (status == "3") {
        this.blstatus = "3";
        this.bltitle = "查看外照射任务";
      }
      personalDosimeterDetail(row.taskPersonalDosimeterId).then(
        async (response) => {
          if (response.data) {
            if (response.data.monitoringState != null) {
              response.data.monitoringState =
                response.data.monitoringState.toString();
            }
            this.handleform = response.data;
            this.handleform.operationList = [];
            if (response.data.entrustOrganizationId && status == "1") {
              getAgreementListWithTaskDosimeter({
                entrustOrganizationId: response.data.entrustOrganizationId,
              }).then((response) => {
                this.agreementList = response.data;
              });
            }
            const files = [
              { name: "记录-128", ossId: response.data.recordOssId },
              { name: "记录-10264", ossId: response.data.recordOssId10264 },
              { name: "报告-128", ossId: response.data.ossId },
              { name: "报告-10264", ossId: response.data.ossId10264 },
              { name: "存根-128", ossId: response.data.archivesOssId },
              { name: "存根-10264", ossId: response.data.archivesOssId10264 },
              { name: "正本-128", ossId: response.data.originalOssId },
              { name: "正本-10264", ossId: response.data.originalOssId10264 },
              // { name: '副本-128', ossId: response.data.copyOssId },
              { name: "副本-10264", ossId: response.data.copyOssId10264 },
              { name: "未签报告", ossId: response.data.copyOssId },
            ];
            this.fileList = files.filter((item) => item.ossId);

            const files128 = [
              { name: "原始记录", ossId: response.data.recordOssId },
              { name: "存根", ossId: response.data.archivesOssId },
              { name: "正本", ossId: response.data.originalOssId },
            ];
            this.fileList128 = files128.filter((item) => item.ossId);

            const files10264 = [
              { name: "原始记录", ossId: response.data.recordOssId10264 },
              { name: "存根", ossId: response.data.archivesOssId10264 },
              { name: "正本", ossId: response.data.originalOssId10264 },
            ];
            this.fileList10264 = files10264.filter((item) => item.ossId);
            // this.fileList = await files.reduce(async (pre, cur) => {
            // 	let pres = await pre
            // 	if (cur.ossId) {
            // 		let {data} = await listByIds(cur.ossId)
            // 		pres.push({...data[0], ...cur})
            // 	}
            // 	return await pres
            // }, [])

            this.handleId = row.taskPersonalDosimeterId;
            this.queryParamsHandle = {
              pageNum: 1,
              pageSize: 10,
              searchStr: "",
            };
            this.getListHandle();
            this.dialogVisiblehandle = true;
          }
        }
      );
      //
      this.getPersonLists(row);
    },
    // 获取未办理人员下拉框
    getPersonLists(row) {
      getUnHandleWorkPersonnelList(row.taskPersonalDosimeterId).then(
        (response) => {
          // if(response.data && response.data.length != 0) {
          this.unHandleWorkPersonnelList = response.data || [];
          this.unHandleWorkPersonnelList.forEach((item) => {
            item.showTypeName =
              item.personnelName +
              (item.dosageType == "1"
                ? "(内)"
                : item.dosageType == "2"
                ? "(外)"
                : "");
            item.originName = item.personnelName;
            item.isEmptyTrackingNumber = !item.sendTrackingNumber;
          });
          // }
        }
      );
    },
    // 分页获取人员（根据row.taskPersonalDosimeterId）
    getListHandle() {
      this.queryParamsHandle.id = this.handleId;
      this.loadingHandle = true;
      getHandleData(this.queryParamsHandle)
        .then((response) => {
          this.handleform.list = response.rows || [];
          if (this.handleform.list.length != 0) {
            this.handleform.list.forEach((item) => {
              item.showTypeName =
                item.personnelName +
                (item.dosageType == "1"
                  ? "(内)"
                  : item.dosageType == "2"
                  ? "(外)"
                  : "");
              item.originName = item.personnelName;
              item.isEmptyTrackingNumber = !item.sendTrackingNumber;
              item.wearingTimes = [item.wearingBeginTime, item.wearingEndTime];
            });
          }
          this.totalHandle = response.total;
          this.loadingHandle = false;
        })
        .catch((response) => {
          this.loadingHandle = false;
        });
    },
    // 分页获取人员（添加时根据单位id）
    getListAdd() {
      this.queryParamsAdd.entrustOrganizationId = this.addId;
      this.loadingAdd = true;
      getWorkingPersonnelByOrganizationId(this.queryParamsAdd)
        .then((response) => {
          this.form.taskPersonalDosimeterResultList = response.rows;
          if (this.form.taskPersonalDosimeterResultList.length != 0) {
            let obj = this.form.taskPersonalDosimeterResultList[0];
            if (obj.wearingBeginTime) {
              this.$set(this.form, "wearingBeginTime", obj.wearingBeginTime);
            }
            if (obj.wearingEndTime) {
              this.$set(this.form, "wearingEndTime", obj.wearingEndTime);
            }
            // 默认批次
            if (obj.batchNum) {
              this.$set(this.form, "batchNum", obj.batchNum);
            }
            // 判断是否为空或列表批次大于单位总批次
            // const judgment = obj.batchNum >= this.form.dosimeterBatchNum
            // if(!obj.batchNum || judgment) {
            // 	this.$prompt(`${judgment ? '请输入总批次' : '请输入续签批次'}`, '提示', {
            // 		confirmButtonText: '确定',
            // 		showCancelButton: false,
            // 		showClose: false,
            // 		closeOnPressEscape: false,
            // 		closeOnClickModal: false,
            // 		inputPattern: /^\d+$/,
            // 		inputErrorMessage: '批次格式不正确'
            // 	}).then(({ value }) => {
            // 		this.form.addBatchNum = Number(value || 0)
            // 	}).catch(() => {
            // 	});
            // }
          }
          this.totalAdd = response.total;
          this.loadingAdd = false;
        })
        .catch((response) => {
          this.loadingAdd = false;
        });
    },
    // 提交办理/保存
    launch(type) {
      let form = {
        id: this.handleform.taskPersonalDosimeterId,
        wearingBeginTime: this.handleform.wearingBeginTime,
        wearingEndTime: this.handleform.wearingEndTime,
        agreementId: this.handleform.agreementId,
        expressageSigningTime: this.handleform.expressageSigningTime,
        operation: type,
        operationList: this.handleform.operationList,
        batchNum: this.handleform.batchNum,
        sendNum: this.handleform.sendNum,
        sendTime: this.handleform.sendTime,
      };
      if (this.handleform.tasksState == 1) {
        this.manageVisible = true;
        this.manageForm = { ...form };
        return;
      }
      personalDosimeterHandle(form).then((response) => {
        if (type == 1) {
          this.dialogVisiblehandle = false;
          this.getList();
          this.queryCanGenAnnualDose();
          this.$modal.msgSuccess("操作成功");
        } else {
          this.getListHandle();
          this.$modal.msgSuccess("保存成功");
        }
        this.handleform.operationList = [];
        this.getPersonLists(this.openRowHandle);
      });
    },
    submitManageData() {
      personalDosimeterHandle(this.manageForm).then((response) => {
        this.manageForm.operation == 1 && this.queryCanGenAnnualDose();
        this.dialogVisiblehandle = false;
        this.manageVisible = false;
        this.manageForm = {};
        this.getList();
        this.$modal.msgSuccess("操作成功");
      });
    },
    // 查询是否可生成年剂量报告
    queryCanGenAnnualDose() {
      let query = {
        entrustOrganizationId: this.handleform.entrustOrganizationId,
        year: this.handleform.year,
      };
      getQueryCanGenAnnualDose(query).then((response) => {
        if (response.data) {
          this.$alert(
            `待审批后，该单位可出具${this.handleform.year}年剂量年度报告`,
            "提示",
            {
              confirmButtonText: "确定",
              callback: (action) => {
                // this.$message({
                // 	type: 'info',
                // 	message: `action: ${ action }`
                // });
              },
            }
          );
        }
      });
    },
    // 生成记录和报告
    handleGenerateReport() {
      let hasErrorTiped = false;
      let hasSuccessTiped = false;
      generateReport(
        this.handleform.taskPersonalDosimeterId,
        this.isPdf,
        "record"
      ).then((response) => {
        if (response.msg && !hasErrorTiped) {
          hasErrorTiped = true;
          this.$alert(
            "<div style='overflow: auto; max-height: 70vh; padding: 0 20px 0; margin-top: -20px;'>" +
              response.msg +
              "</div>",
            "生成失败",
            { dangerouslyUseHTMLString: true }
          );
        } else {
          if (response.data) {
            if (!hasSuccessTiped) {
              hasSuccessTiped = true;
              this.$alert(
                "<div style='overflow: auto; max-height: 70vh; padding: 0 20px 0; font-size: 16px'>" +
                  "生成成功！" +
                  "</div>",
                "",
                { dangerouslyUseHTMLString: true }
              );
            }
          }
        }
      });
      generateReport(
        this.handleform.taskPersonalDosimeterId,
        this.isPdf,
        "report"
      ).then((response) => {
        if (response.msg && !hasErrorTiped) {
          hasErrorTiped = true;
          this.$alert(
            "<div style='overflow: auto; max-height: 70vh; padding: 0 20px 0; margin-top: -20px;'>" +
              response.msg +
              "</div>",
            "生成失败",
            { dangerouslyUseHTMLString: true }
          );
        } else {
          if (response.data) {
            if (!hasSuccessTiped) {
              hasSuccessTiped = true;
              this.$alert(
                "<div style='overflow: auto; max-height: 70vh; padding: 0 20px 0; font-size: 16px'>" +
                  "生成成功！" +
                  "</div>",
                "",
                { dangerouslyUseHTMLString: true }
              );
            }
          }
        }
      });
    },
    // 刷新报告
    handleRefreshReport() {
      personalDosimeterDetail(this.openRowHandle.taskPersonalDosimeterId).then(
        (response) => {
          this.$message.success("刷新成功");
          this.handleform.isReport = response.data?.isReport; /* 更新isReport */
          this.handleform.recordReportState = response.data?.recordReportState;
          if (response.data?.ossId) {
            /* 更新报告 */
            const findRes = this.fileList.find((it) => it.name == "报告-128");
            if (findRes) findRes.ossId = response.data.ossId;
            else
              this.fileList.push({
                name: "报告-128",
                ossId: response.data.ossId,
              });
          }
          if (response.data?.recordOssId) {
            /* 更新原始记录 */
            const findRes = this.fileList128.find(
              (it) => it.name == "原始记录"
            );
            if (findRes) findRes.ossId = response.data.recordOssId;
            else
              this.fileList128.push({
                name: "原始记录",
                ossId: response.data.recordOssId,
              });
          }
          if (response.data?.copyOssId) {
            /* 更新未签报告 */
            const findRes = this.fileList.find((it) => it.name == "未签报告");
            if (findRes) findRes.ossId = response.data.copyOssId;
            else
              this.fileList.push({
                name: "未签报告",
                ossId: response.data.copyOssId,
              });
          }
        }
      );
    },
    // 生成报告
    // handleReport(type='report') {
    // 	generateReport(this.handleform.taskPersonalDosimeterId, this.isPdf,type).then((response) => {
    // 		if (response.msg) { /* 生成错误 */
    // 			this.$alert("<div style='overflow: auto; max-height: 70vh; padding: 0 20px 0; margin-top: -20px;'>" + response.msg + "</div>", "生成失败", { dangerouslyUseHTMLString: true });
    // 		}else {
    // 			if(response.data) {
    // 				this.$alert("<div style='overflow: auto; max-height: 70vh; padding: 0 20px 0; font-size: 16px'>" + '生成成功！' + "</div>", "", { dangerouslyUseHTMLString: true });
    // 				listByIds(response.data).then((response) => {
    // 					this.fileList = response.data.map(item => {
    // 						return {
    // 							url: item.url,
    // 							originalName: item.originalName,
    // 						}
    // 					});
    // 				});
    // 			}
    // 		}
    // 		personalDosimeterDetail(this.openRowHandle.taskPersonalDosimeterId).then((response) => {
    // 			this.handleform.isReport = response.data?.isReport; /* 更新isReport */
    //       this.handleform.recordReportState = response.data?.recordReportState
    // 			if (response.data?.ossId) {  /* 更新生成报告 */
    // 				listByIds(response.data.ossId).then((response) => {
    // 					this.fileList = response.data.map(item => {
    // 						return {
    // 							url: item.url,
    // 							originalName: item.originalName,
    // 						}
    // 					});
    // 				});
    // 			}
    //       if (response.data?.recordOssId) {  /* 更新生成报告 */
    //       	listByIds(response.data.recordOssId).then((response) => {
    //       		this.fileRecordList = response.data.map(item => {
    //       			return {
    //       				url: item.url,
    //       				originalName: item.originalName,
    //       			}
    //       		});
    //       	});
    //       }
    // 		});
    // 	});
    // },
    // 修改是否显示在报告中
    handleChangeShowReport(row) {
      updateShowReport(
        row.taskPersonalResultId,
        row.showReport == 0 ? 1 : 0
      ).then((res) => {
        if (res.code == 200) {
          this.getListHandle();
          this.$modal.msgSuccess("修改成功");
        }
      });
    },
    viewAllFile(row) {
      this.$refs["reportDialogRefs"].openDialog(row);
    },
    // 报告预览
    async viewFile(item, isTable, isRecords) {
      if (isTable) {
        /* 已签发列表打开 */
        if (item.ossId) {
          listByIds(item.ossId).then((response) => {
            // isRecords && this.handleIsPrint();
            window.open(response?.data[0]?.url, "PDF", "");
          });
        } else {
          this.$modal.msgWarning("暂无文件");
        }
      } else {
        let { data } = await listByIds(item.ossId);
        if (item.ossId && data) {
          window.open(data[0]?.url, "PDF", "");
        } else {
          this.$modal.msgWarning("暂无文件");
        }
      }
    },
    // 是否打印报告
    handleIsPrint() {
      personalPrintReport({
        dosimeterId: this.handleform.taskPersonalDosimeterId,
      }).then((res) => {
        this.getList();
      });
    },
    // 流转登记表
    async handlePrintTurnoverRegister() {
      await handlePrintTurnoverRegister(
        this.handleform.taskPersonalDosimeterId,
        "2",
        true
      );
      // let LODOP = getLodop()
      // LODOP.PRINT_INIT('流转登记表')
      // LODOP.SET_PRINT_PAGESIZE(1, 0, 0, 'A4')
      // genCirculationRegister(this.handleform.taskPersonalDosimeterId).then(response => {
      // 	// console.log(response);
      // 	// listByIds(res.data).then((response) => {
      // 	// 	window.open(response.data[0].url, 'pdf')
      // 	// });
      // 	let binaryData = []
      // 	binaryData.push(response.data)
      // 	blobToBase64(
      // 		new Blob(binaryData, { type: 'application/pdf' })
      // 	).then((res) => {
      // 		LODOP.ADD_PRINT_PDF(
      // 			'0',
      // 			'0',
      // 			'100%',
      // 			'100%',
      // 			res.split('data:application/pdf;base64,')[1]
      // 		)
      // 		// console.log(res);
      // 		// 设置对后台打印状态进行捕获
      // 		LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)
      // 		// LODOP.PRINT();
      // 		LODOP.PREVIEW() // 预览
      // 	})
      // })
    },
    // 告知书
    async handlePrintnotice() {
      await handlePrintNotice(
        this.handleform.taskPersonalDosimeterId,
        "2",
        true
      );
      // let LODOP = getLodop()
      // LODOP.PRINT_INIT('告知书')
      // LODOP.SET_PRINT_PAGESIZE(1, 0, 0, 'A4')
      // genDosageNotification(this.handleform.taskPersonalDosimeterId).then(response => {
      // 	// console.log(response);
      // 	// listByIds(res.data).then((response) => {
      // 	// 	window.open(response.data[0].url, 'pdf')
      // 	// });
      // 	let binaryData = []
      // 	binaryData.push(response.data)
      // 	blobToBase64(
      // 		new Blob(binaryData, { type: 'application/pdf' })
      // 	).then((res) => {
      // 		LODOP.ADD_PRINT_PDF(
      // 			'0',
      // 			'0',
      // 			'100%',
      // 			'100%',
      // 			res.split('data:application/pdf;base64,')[1]
      // 		)
      // 		// console.log(res);
      // 		// 设置对后台打印状态进行捕获
      // 		LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)
      // 		// LODOP.PRINT();
      // 		LODOP.PREVIEW() // 预览
      // 	})
      // })
    },
    // 更改单位（添加时）
    changeEntrustOrganizationId(val) {
      this.addId = val;
      this.deletePerson = [];
      let obj = this.entrustOrganizationSelect.find((item) => {
        return item.entrustOrganizationId == val;
      });
      if (!obj) {
        this.form = {
          taskPersonalDosimeterResultList: [],
        };
        this.agreementList = [];
        return;
      }
      this.$set(this.form, "contactsName", obj.contactsName);
      this.$set(this.form, "contactsMobile", obj.contactsMobile);
      this.$set(this.form, "monitoringCycle", obj.monitoringCycle);
      this.$set(this.form, "monitoringState", obj.monitoringState);
      this.$set(this.form, "organizationAddress", obj.addressDetails);
      this.$set(this.form, "dosimeterBatchNum", obj.dosimeterBatchNum);
      this.$set(this.form, "formDate", null);
      getAgreementListWithTaskDosimeter({ entrustOrganizationId: val }).then(
        (response) => {
          this.agreementList = response.data;
        }
      );
      this.getListAdd();
    },
    // 删除
    handleDelete(row) {
      this.$modal
        .confirm(`是否确认删除任务 [${row.agreementNumber}]？`)
        .then(() => {
          this.loading = true;
          return personalDosimeterRemove(row.taskPersonalDosimeterId);
        })
        .then(() => {
          this.loading = false;
          this.$modal.msgSuccess("删除成功");
          this.getList();
        })
        .finally(() => {
          this.loading = false;
        });
    },
    deleteData(row, index) {
      console.log("删除索引", index);
      this.$modal.confirm(`是否确认删除该数据？`).then(() => {
        this.deletePerson.push(row);
        this.form.taskPersonalDosimeterResultList.splice(index, 1);
      });
    },
    // 查询重置
    reset() {
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
        // tasksState: this.isPer ? '-4' : '-3',
        tasksState: this.activeName,
      };
      this.resetForm("queryParams");
      this.getList();
    },
    // 更改打印勾选
    handleSelectionChange(selection) {
      this.selected = selection;
    },
    // 打印编号
    async handlePrint() {
      let printList = [];
      if (this.selected.length == 0) {
        // printList = JSON.parse(JSON.stringify(this.handleform.list)); // 当前页数
        let { code, data } = await getWaitSendPersonnelListByIds({
          dosimeterIds: [this.handleform.taskPersonalDosimeterId],
          isFilter: 0,
        });
        printList = data || [];
      } else {
        printList = this.selected;
      }
      this.loading = true;
      await printCodeZY(printList, "1", true);
      this.loading = false;
    },
    //
    handlePrintReports(type) {
      if (type == "128") {
        const file = [
          { name: "存根", ossId: this.handleform.archivesOssId },
          { name: "正本", ossId: this.handleform.originalOssId },
        ];
        handlePrintReport(file, "2", true);
      } else if (type == "10264") {
        const file = [
          { name: "存根", ossId: this.handleform.archivesOssId10264 },
          { name: "正本", ossId: this.handleform.originalOssId10264 },
        ];
        handlePrintReport(file, "2", true);
      }
    },
    // 给单元格绑定横向和竖向的index，这样就能确定是哪一个单元格
    tableCellClassName({ row, column, rowIndex, columnIndex }) {
      row.index = rowIndex;
      column.index = columnIndex;
    },
    // 获得当前双击的单元格的横竖index，然后拼接成一个唯一字符串用于判断，并赋给currentCell
    // 拼接后类似这样："1,0","1,1",
    dbclick(row, column) {
      if (this.handleStatus == "3") return;
      console.log("双击", row, column);
      this.currentCell = row.index + "," + column.index;
      // 这里必须要setTimeout，因为在点击的时候，input才刚被v-if显示出来，不然拿不到dom
      setTimeout(() => {
        // 双击后自动获得焦点
        if (this.$refs[row.index + "," + column.index]) {
          this.$refs[row.index + "," + column.index].focus();
        }
      });
    },
    // 更改未处理人员
    changeUnhandledPerson(val, row) {
      let findobj = this.unHandleWorkPersonnelList.find(
        (item) => item.showTypeName == val
      );
      let findindex = this.unHandleWorkPersonnelList.findIndex(
        (item) => item.showTypeName == val
      );
      if (findobj) {
        this.unHandleWorkPersonnelList.splice(findindex, 1);
        this.$set(row, "personnelNumber", findobj.personnelNumber);
        this.$set(row, "dosageNumber", findobj.dosageNumber);
        this.$set(row, "personnelName", findobj.personnelName);
        this.$set(row, "personnelSex", findobj.personnelSex);
        this.$set(
          row,
          "occupationalClassification",
          findobj.occupationalClassification
        );
        this.$set(row, "wearingBeginTime", findobj.wearingBeginTime);
        this.$set(row, "wearingEndTime", findobj.wearingEndTime);
        this.$set(row, "sendTrackingNumber", findobj.sendTrackingNumber);
        this.$set(row, "holeOneDosageValue", findobj.holeOneDosageValue);
        this.$set(row, "holeTwoDosageValue", findobj.holeTwoDosageValue);
        this.$set(row, "dosageValue", findobj.dosageValue);
        this.$set(row, "dosageType", findobj.dosageType);
        this.$set(row, "taskPersonalResultId", findobj.taskPersonalResultId);
        this.$set(row, "personnelId", findobj.personnelId);
        this.$set(row, "originName", findobj.originName);
        this.$set(row, "isEmptyTrackingNumber", findobj.isEmptyTrackingNumber);
        console.log("更改后", row, findobj);
        if (row.isadd) {
          /* 添加行 */
          this.currentCell = null;
          row.operation = 0;
          this.handleform.operationList.push({ ...row });
          this.$set(row, "isadd", false);
          if (
            this.openRowHandle.tasksState == "0" ||
            this.openRowHandle.tasksState == "3"
          ) {
            this.launch(0); /* 调用保存 */
          }
        } else {
          /* 修改行 */
          this.hideInput(row);
        }
      }
    },
    // 当input失去焦点的时候，隐藏input, 推入修改列表
    hideInput(row) {
      console.log("hideInput", this.handleform);
      if (row.personnelName && row.personnelName.trim() == "") {
        this.$set(row, "personnelName", row.originName);
      }

      if (row.wearingTimes) {
        this.$set(row, "wearingBeginTime", row.wearingTimes[0]);
        this.$set(row, "wearingEndTime", row.wearingTimes[1]);
      }

      this.currentCell = null;
      row.operation = 1;
      this.handleform.operationList.push({ ...row });
    },
    // 添加行
    addLine() {
      // if(this.unHandleWorkPersonnelList.length == 0) {
      // 	this.$message.warning('暂无可添加人员');
      // 	return;
      // }
      const lenght = this.handleform.list?.length || 0;
      if (this.handleform.list[lenght - 1].isadd) {
        return;
      }
      console.log(this.handleform);
      this.handleform.list.push({
        isadd: true,
      });
      this.totalHandle += 1;
      this.currentCell = this.handleform.list.length - 1 + "," + 3;
      this.$nextTick(() => {
        this.$refs.tableData.bodyWrapper.scrollTop =
          this.$refs.tableData.bodyWrapper.scrollHeight;
      });
    },
    /**
     * 删除行
     * @param index 下标
     * @param hasTips 是否存在提示
     */
    deleteItem(index, noTips = false) {
      if (!this.handleform.list[index].taskPersonalResultId) {
        this.handleform.list.splice(index, 1);
        this.totalHandle -= 1;
      } else if (noTips) {
        this.handleform.list[index].operation = 2;
        this.handleform.operationList.push({ ...this.handleform.list[index] });

        this.unHandleWorkPersonnelList.push({ ...this.handleform.list[index] });

        const temp = this.unHandleWorkPersonnelList;
        this.unHandleWorkPersonnelList = temp.filter((item, index, arr) => {
          return (
            arr.findIndex((i) => i.showTypeName === item.showTypeName) === index
          );
        });

        this.handleform.list.splice(index, 1);
        this.totalHandle -= 1;
      } else {
        this.$modal.confirm(`是否确认删除该人员？`).then(() => {
          this.handleform.list[index].operation = 2;
          this.handleform.operationList.push({
            ...this.handleform.list[index],
          });

          this.unHandleWorkPersonnelList.push({
            ...this.handleform.list[index],
          });
          // 去除重复数据
          const temp = this.unHandleWorkPersonnelList;
          this.unHandleWorkPersonnelList = temp.filter((item, index, arr) => {
            return (
              arr.findIndex((i) => i.showTypeName === item.showTypeName) ===
              index
            );
          });
          this.handleform.list.splice(index, 1);
          this.totalHandle -= 1;
        });
      }
    },
    // 异常报备
    handleException(row, exceptionType) {
      console.log(exceptionType);

      this.abnormalTitle = "确定异常报备吗？";
      this.abnormalFrom = {
        taskPersonalResultId: [row.taskPersonalResultId],
        exceptionType,
        addNotionalDoseFlag: "1",
      };
      this.abnormalVisible = true;

      // this.$modal.confirm(`确定异常报备吗？`).then(() => {
      // 	addExceptionalRecord({
      // 		taskPersonalResultId: [row.taskPersonalResultId],
      // 		exceptionType: 2,
      // 	}).then((response) => {
      // 		this.$modal.msgSuccess("报备成功");
      // 		this.getListHandle();
      // 	});
      // });
    },
    // 异常报备确定
    handleAbnormalConfim() {
      this.$refs["abnormalRefs"].validate((valid) => {
        if (!valid) return;

        addExceptionalRecord(this.abnormalFrom).then((response) => {
          this.$modal.msgSuccess("报备成功");
          this.getListHandle();
          this.abnormalVisible = false;
        });
      });
    },
    querySearch(queryString, cb) {
      let restaurants = this.dict.type.exception_type;
      let results = queryString
        ? restaurants.filter((i) => i.label.indexOf(queryString) > -1)
        : restaurants;
      // 调用 callback 返回建议列表的数据
      cb(results);
    },
    // 打开快递单号对话框
    editTrackingNumber() {
      // this.editTrackingNumberVisible = true;
      // this.editTrackingNumberForm = {};
      // this.resetForm("editTrackingNumberForm");

      const data = {
        dosimeterId: this.handleform.taskPersonalDosimeterId,
        resultIds: this.selected
          .map((item) => item.taskPersonalResultId)
          .filter((item) => item),
      };
      addSendTrackingNumber(data).then((response) => {
        this.$modal.msgSuccess("发样成功");
        this.activeName = "-2";
        this.changeTab({ name: -2 });
      });
    },
    // 提交快递单号
    // submitTrackingNumber() {
    //   this.$refs["editTrackingNumberForm"].validate((valid) => {
    //     if (!valid) return;
    // 		this.editTrackingNumberForm.dosimeterId = this.handleform.taskPersonalDosimeterId;
    // 		this.editTrackingNumberForm.resultIds = this.selected.map(item => item.taskPersonalResultId).filter(item => item);
    // 		addSendTrackingNumber(this.editTrackingNumberForm).then((response) => {
    // 			this.$modal.msgSuccess("修改成功");
    // 			this.editTrackingNumberVisible = false;
    // 			this.activeName = "-2";
    // 			this.changeTab({name: -2});
    // 			// 不勾选是没有的添加 勾选是勾选的全部修改 (新增的行只能选择人员 选择完后变为输入框 只有单号未空才能双击修改 否则点击修改单号按钮才能修改)
    // 			this.handleform.list.forEach(item => {
    // 				if (this.selected.length == 0 && !item.sendTrackingNumber) {
    // 					this.$set(item, "sendTrackingNumber", this.editTrackingNumberForm.sendTrackingNumber);
    // 				}
    // 				if (this.selected.length != 0 && this.selected.find(it => it.taskPersonalResultId == item.taskPersonalResultId)) {
    // 					this.$set(item, "sendTrackingNumber", this.editTrackingNumberForm.sendTrackingNumber);
    // 				}
    // 			})
    // 			this.handleform.operationList.forEach(item => {
    // 				if (this.selected.length == 0 && !item.sendTrackingNumber) {
    // 					this.$set(item, "sendTrackingNumber", this.editTrackingNumberForm.sendTrackingNumber);
    // 				}
    // 				if (this.selected.length != 0 && this.selected.find(it => it.taskPersonalResultId == item.taskPersonalResultId)) {
    // 					this.$set(item, "sendTrackingNumber", this.editTrackingNumberForm.sendTrackingNumber);
    // 				}
    // 			})
    // 		});
    //   });
    // },
    // 文件移除
    handleRemove(file, fileList) {
      this.uploadFileList = fileList;
    },
    handleRemoveRecord(file, fileList) {
      this.uploadRecordFileList = fileList;
    },
    // 报告文件上传成功
    handleFileSuccess(response, file, fileList) {
      if (response.code == 500) {
        this.$modal.msgWarning(response.msg);
      }
      this.uploadFileList = fileList;

      uploadReport({
        dosimeterId: this.handleform.taskPersonalDosimeterId,
        ossId: response.data.ossId,
        reportType: 1,
      }).then((response) => {
        this.$modal.msgSuccess("上传成功");
        personalDosimeterDetail(
          this.openRowHandle.taskPersonalDosimeterId
        ).then((response) => {
          if (response.data && response.data.ossId) {
            // listByIds(response.data.ossId).then((response) => {
            // 	this.fileList = response.data.map(item => {
            // 		return {
            // 			url: item.url,
            // 			originalName: item.originalName,
            // 		}
            // 	});
            // });
            const findRes = this.fileList.find((it) => it.name == "报告-128");
            if (findRes) findRes.ossId = response.data.ossId;
          }
        });
      });
    },
    // 记录文件上传成功
    handleFileSuccessRecord(response, file, fileList) {
      if (response.code == 500) {
        this.$modal.msgWarning(response.msg);
      }
      this.uploadRecordFileList = fileList;

      uploadReport({
        dosimeterId: this.handleform.taskPersonalDosimeterId,
        ossId: response.data.ossId,
        reportType: 0,
      }).then((response) => {
        this.$modal.msgSuccess("上传成功");
        personalDosimeterDetail(
          this.openRowHandle.taskPersonalDosimeterId
        ).then((response) => {
          if (response.data && response.data.recordOssId) {
            // listByIds(response.data.ossId).then((response) => {
            // 	this.fileList = response.data.map(item => {
            // 		return {
            // 			url: item.url,
            // 			originalName: item.originalName,
            // 		}
            // 	});
            // });
            const findRes = this.fileList128.find(
              (it) => it.name == "原始记录"
            );
            if (findRes) findRes.ossId = response.data.recordOssId;
          }
        });
      });
    },
    // 合并文件预览
    handlePreview(file, fileList) {
      console.log("handlePreview", file, fileList);
      // 上传时
      if (file.response && file.response.data) {
        window.open(file.response.data.url, "PDF", "");
      } else if (file.url) {
        window.open(file.url, "PDF", "");
      }
    },
    // 上传前
    beforeAvatarUpload(file) {
      console.log("file", file);
      let lastIndex = file.name.lastIndexOf(".");
      let suffix = file.name.substring(lastIndex + 1);
      console.log("suffix", suffix);
      if (suffix != "docx") {
        this.$message.warning("仅支持docx格式，请重新上传!");
        return false;
      } else {
        return true;
      }
    },
    // 超出数量提示
    handleExceed(files, fileList) {
      this.$message.warning(`当前限制选择 1 个文件`);
    },
    // 生成任务
    handleGenerateTask() {
      this.showOuterTaskGenerateDialog = true;
    },
  },
};
</script>

<style lang="scss" scoped>
.app-container {
  display: flex;
  flex-direction: column;
}

.uploadbutton {
  padding-inline: 20px;
}
.myupload {
  margin-bottom: 20px;
}
.result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 30px;
  .calc {
    width: min-content;
    margin-left: 20px;
    .el-button {
      margin: 0;
      &:nth-of-type(1) {
        margin-bottom: 10px;
      }
    }
  }
}
.nametitle {
  text-align: center;
  margin-bottom: 10px;
  font-weight: bolder;
  &::before {
    content: "* ";
    color: red;
  }
}
::v-deep .el-table .warning-row {
  color: red;
}
.searchcontainer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: -10px;
}
.viewform {
  justify-content: flex-end;
}
.title {
  padding-left: 10px;
  border-left: 5px solid #2a72ee;
  text-align: left;
  font-weight: bolder;
  font-size: 16px;
  margin-bottom: 30px;
}
.operation {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  .editform {
    .el-form-item {
      margin-bottom: 0;
    }
  }
}
.bloperation {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 10px;
  .filelist {
    margin: 0 auto 0 0;
    margin-left: 30px;
    margin-right: 30px;
    font-weight: bolder;
    .filelistitem {
      color: #2a72ee;
      cursor: pointer;
      &:hover {
        color: #2a72ee;
        text-decoration: underline;
      }
    }
  }
  .docupload {
    display: flex;
    margin-right: auto;
    // width: 500px;
    > * {
      margin-right: 12px;
      &:last-child {
        margin-right: 0;
      }
    }
    ::v-deep .el-upload-list {
      max-width: 300px;
      .el-upload-list__item {
        margin-top: 3px;
        .el-icon-close-tip {
          display: none;
        }
      }
    }
  }
  .type {
    margin-right: 20px;
  }
  .blbutton {
    margin-right: 20px;
  }
}
.form-filelist {
  .label {
    margin-right: 8px;
    font-weight: bold;
    font-size: 18px;
  }
  .filelistitem {
    color: #2a72ee;
    cursor: pointer;
    margin-right: 16px;
    &:hover {
      color: #2a72ee;
      text-decoration: underline;
    }
    &:last-of-type {
      margin-right: 0;
    }
  }
}

.contral-container {
  margin: 8px 0;
  .contral-col {
    display: flex;
    align-items: center;
    flex: 1;
    > * {
      margin-right: 10px;
    }
    .filelist {
      margin: 0 auto 0 0;
      margin-left: 30px;
      margin-right: 30px;
      font-weight: bolder;
      .filelistitem {
        color: #2a72ee;
        cursor: pointer;
        &:hover {
          color: #2a72ee;
          text-decoration: underline;
        }
      }
    }
  }

  .type {
    display: flex;
    align-items: center;
    margin-right: 20px;
  }
  .all-contral {
    margin-left: 10px;
  }
}
.codecontainer {
  width: 5cm;
  height: 10cm;
  .item {
    color: red;
    font-size: 12px;
  }
}
// 生成图片样式
.printmy {
  position: relative;
  font-size: 10px;
  background-color: aqua;
  width: 50mm;
  height: 23mm;
  margin-bottom: 5mm;
  padding: 2mm;
  .barcode {
    position: absolute;
    top: 2mm;
    right: 3mm;
  }
}
::v-deep .handletabel.el-table {
  overflow: auto;
  .el-table__body-wrapper {
    overflow-y: auto;
    overflow-x: auto;
  }
}
.flowdialog .el-tabs {
  height: 700px;
  overflow: auto;
}
.blbtn {
  margin-right: 50px;
}
.bldialog ::v-deep .el-dialog {
  max-height: 95%;
  .el-dialog__body {
    position: relative;
  }
}
.addtask ::v-deep .el-dialog__body {
  position: relative;
}
.wearingedit ::v-deep .el-input__inner {
  padding-right: 0;
}
.selectperson ::v-deep .el-input__inner {
  padding-right: 7px;
}
.separate {
  width: 100%;
  height: 1px;
  background-color: #d2d2d2;
  margin-bottom: 15px;
}
::v-deep .el-button.ovbutton {
  padding-block: 0;
}
::v-deep .tab {
  margin-top: -10px;
}

</style>
